﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SmartSpace.Cwt;
using SmartSpace.Core;
using System.Text;

namespace WebApp.Parts
{
    public partial class ArticleListC3Part : System.Web.UI.UserControl
    {
        public string CagetoryCode { get; set; }

        private PagedList<Article> Source { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ICwtService service = Global.Get<ICwtService>();
                Category category = service.FindCategory(this.CagetoryCode);
                if (category != null)
                {
                    this._ctlHeadCategory.InnerText = category.Caption;

                    Source = service.FindArticles(this.CagetoryCode, 0, 5);
                    this._ctlRepeater.DataSource = Source;
                    this._ctlRepeater.DataBind();
                }
            }
        }
    }
}